package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	file, err := os.OpenFile("./2.txt", os.O_WRONLY|os.O_APPEND, 0666)
	defer file.Close()
	if err != nil {
		fmt.Println(err)
	}
	str := "hello hello"
	writer := bufio.NewWriter(file)
	var str1 string
	for i := 0; i < 5; i++ {
		str1 = str + strconv.Itoa(i)
		writer.WriteString(str1)
		writer.WriteString("\r\n")
	}
	writer.Flush()
}
